<html>
<head><meta charset="utf-8"><title>range reform · edition 2021 · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/index.html">edition 2021</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html">range reform</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="225248870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/225248870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#225248870">(Feb 05 2021 at 01:14)</a>:</h4>
<p>I wrote up a draft of an RFC covering the proposed changes to range syntax desugaring: <a href="https://hackmd.io/cM22mZ5JRH2RAdSART8bWQ">https://hackmd.io/cM22mZ5JRH2RAdSART8bWQ</a></p>



<a name="225249426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/225249426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#225249426">(Feb 05 2021 at 01:23)</a>:</h4>
<p>If renaming the 2018 <code>Range</code> to <code>RangeIter</code> is an option I have a strong preference for that. What would be necessary to make that work? Is a <code>prelude::v2</code> required?</p>



<a name="225249482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/225249482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#225249482">(Feb 05 2021 at 01:24)</a>:</h4>
<p>It would require some new kind of compiler support to conditionally rename a type based on an edition.</p>



<a name="225249494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/225249494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#225249494">(Feb 05 2021 at 01:24)</a>:</h4>
<p>But I think it is more of a "should we" question rather than "can we"</p>



<a name="225249501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/225249501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#225249501">(Feb 05 2021 at 01:24)</a>:</h4>
<p>the UX around rustdoc would also require thought</p>



<a name="225259685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/225259685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#225259685">(Feb 05 2021 at 04:15)</a>:</h4>
<p>Great to see this written up!  I tossed in a few minor things that jumped to mind while reading.</p>



<a name="225294120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/225294120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#225294120">(Feb 05 2021 at 12:49)</a>:</h4>
<p><span class="user-mention" data-user-id="243558">@Steven Fackler</span> Might be good to mention what this change would mean for the <code>Index</code> trait implementations for slices and other crates in the ecosystem. And whether <code>RangeBounds</code> will be implemented for both <code>Range</code> and <code>Range2</code> (etc.).</p>



<a name="225295532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/225295532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#225295532">(Feb 05 2021 at 13:03)</a>:</h4>
<p>I added a sentence about that, thanks</p>



<a name="225295588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/225295588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#225295588">(Feb 05 2021 at 13:03)</a>:</h4>
<p>oh yeah i'll talk about how the ecosystem should update as well</p>



<a name="229586383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/229586383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#229586383">(Mar 10 2021 at 01:20)</a>:</h4>
<p>I updated the draft to match what we discussed last week: <a href="https://hackmd.io/cM22mZ5JRH2RAdSART8bWQ?view#Reference-level-explanation">https://hackmd.io/cM22mZ5JRH2RAdSART8bWQ?view#Reference-level-explanation</a></p>



<a name="229586445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/229586445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#229586445">(Mar 10 2021 at 01:21)</a>:</h4>
<p>I still need to write the guide-level explanation section, which will mostly cover how third party libraries should think about implementing things for the new types.</p>



<a name="230364778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230364778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230364778">(Mar 15 2021 at 15:32)</a>:</h4>
<p><span class="user-mention" data-user-id="243558">@Steven Fackler</span> I just realized that <a href="https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_ptr_range"><code>slice::as_ptr_range</code></a> gives a <code>Range</code> of pointers. that one would be a bit weird if we have both Copy and Iterator Ranges, because it's returning the Iterator one instead of the Copy one. maybe we can change it without breaking too much, but it's also something to look at. :(</p>



<a name="230365505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230365505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230365505">(Mar 15 2021 at 15:36)</a>:</h4>
<p>Yeah, we may just be stuck with those methods unfortunately</p>



<a name="230420419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230420419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230420419">(Mar 15 2021 at 21:19)</a>:</h4>
<p>I was saying to <span class="user-mention" data-user-id="310399">@Mara</span> earlier that maybe we should get a new name, like <code>Interval</code>?</p>



<a name="230420475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230420475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230420475">(Mar 15 2021 at 21:20)</a>:</h4>
<p>then we can have <code>as_ptr_interval</code></p>



<a name="230758332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230758332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230758332">(Mar 17 2021 at 20:10)</a>:</h4>
<p>I'm sorry for taking a while to notice this but</p>



<a name="230758387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230758387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230758387">(Mar 17 2021 at 20:10)</a>:</h4>
<p>I don't think this solves anything, other than <code>RangeInclusive</code> having that extra field only for iteration purposes</p>



<a name="230758454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230758454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230758454">(Mar 17 2021 at 20:11)</a>:</h4>
<p>at least not if we keep in mind the reason for why iterators don't implement <code>Copy</code></p>



<a name="230758488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230758488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230758488">(Mar 17 2021 at 20:11)</a>:</h4>
<p>I wrote this up in <a href="https://github.com/rust-lang/rfcs/issues/2848#issuecomment-801401285">https://github.com/rust-lang/rfcs/issues/2848#issuecomment-801401285</a> but I might be able to discuss it here as well</p>



<a name="230758802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230758802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230758802">(Mar 17 2021 at 20:13)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/268952-edition-2021/topic/range.20reform/near/230420419">said</a>:</p>
<blockquote>
<p>I was saying to <span class="user-mention silent" data-user-id="310399">Mara</span> earlier that maybe we should get a new name, like <code>Interval</code>?</p>
</blockquote>
<p>I'm not strongly opposed to <code>Interval</code> but it feels weird, in part because it suggests something "continuous", but also it's mostly just a synonym</p>



<a name="230759636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230759636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230759636">(Mar 17 2021 at 20:18)</a>:</h4>
<p>While it's true that</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">iter</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="o">..</span><span class="mi">10</span><span class="p">;</span><span class="w"></span>
<span class="k">for</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">iter</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">if</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">5</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">break</span><span class="p">;</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="k">for</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">iter</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>
<p>will copy instead of mutate the iterator, and so can be seen as  "no improvement over status quo", I would argue that with the new ranges this is no longer unexpected behavior, it's just the same as iterating over any other <code>IntoIterator</code> thing like a vector. It's not even mutable, so it would be weird to expect that it is mutated</p>



<a name="230759669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230759669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230759669">(Mar 17 2021 at 20:19)</a>:</h4>
<p>I don't get this argument</p>



<a name="230759692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230759692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230759692">(Mar 17 2021 at 20:19)</a>:</h4>
<p>the original argument was about <em>what the code looks like</em></p>



<a name="230759701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230759701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230759701">(Mar 17 2021 at 20:19)</a>:</h4>
<p>there's no types in it <em>that make it look different</em></p>



<a name="230759737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230759737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230759737">(Mar 17 2021 at 20:19)</a>:</h4>
<p>when I look at that code I see that you are iterating twice over 0..10, and that's what it does</p>



<a name="230759739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230759739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230759739">(Mar 17 2021 at 20:19)</a>:</h4>
<p>there's nothing explicit about the fact that which <code>IntoIterator</code> impl gets called, changed</p>



<a name="230759831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230759831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230759831">(Mar 17 2021 at 20:20)</a>:</h4>
<p><span class="user-mention" data-user-id="271719">@Mario Carneiro</span> sure but <em>the</em> argument for why we shouldn't let that compile is because that might not be clear to everyone at a glance</p>



<a name="230759898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230759898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230759898">(Mar 17 2021 at 20:20)</a>:</h4>
<p>if that argument doesn't hold we can go <code>impl</code> <code>Copy</code> on a dozen iterator types <em>yesterday</em></p>



<a name="230759967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230759967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230759967">(Mar 17 2021 at 20:21)</a>:</h4>
<p>it's not like whether the type implements <code>Iterator</code> changes the semantics or anything like that</p>



<a name="230759981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230759981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230759981">(Mar 17 2021 at 20:21)</a>:</h4>
<p><code>for</code> <em>always</em> copies/moves</p>



<a name="230760023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760023">(Mar 17 2021 at 20:21)</a>:</h4>
<p>I'm looking at the far future situation where we aren't worried about backward compatibility; in that case I would want that code to compile and do the obvious thing. Making that code not compile would just punch a hole in an otherwise stable pattern</p>



<a name="230760108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760108">(Mar 17 2021 at 20:22)</a>:</h4>
<p>I don't understand what you mean</p>



<a name="230760130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760130">(Mar 17 2021 at 20:22)</a>:</h4>
<p>since we changed the desugaring of <code>for</code>, there has been constant pushback against having <code>Copy</code> iterators</p>



<a name="230760140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760140">(Mar 17 2021 at 20:22)</a>:</h4>
<p>through <em>this one</em> argument</p>



<a name="230760183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760183">(Mar 17 2021 at 20:23)</a>:</h4>
<p>I'm not happy about things happening that don't seem to account for the history of this issue :/</p>



<a name="230760224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760224">(Mar 17 2021 at 20:23)</a>:</h4>
<p>because whether that argument holds any water at any official level has <em>far broader</em> implications than just <code>Range</code></p>



<a name="230760225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760225">(Mar 17 2021 at 20:23)</a>:</h4>
<p>I don't follow. That argument seems to apply here. <code>0..10</code> is copy but <code>(0..10).into_iter()</code> isn't</p>



<a name="230760256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760256">(Mar 17 2021 at 20:23)</a>:</h4>
<p>the argument is about the code without any explicit calls in it</p>



<a name="230760307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760307">(Mar 17 2021 at 20:24)</a>:</h4>
<p>it's not about types or traits</p>



<a name="230760327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760327">(Mar 17 2021 at 20:24)</a>:</h4>
<p>it's about <em>what the code looks like</em></p>



<a name="230760425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760425">(Mar 17 2021 at 20:25)</a>:</h4>
<p><code>for x in iterable</code> <em>always</em> compiles like <code>for x in iterable.into_iter()</code> even when <code>typeof(iterable): Iterator</code></p>



<a name="230760454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760454">(Mar 17 2021 at 20:25)</a>:</h4>
<p><code>for</code> takes its argument by value, so I don't expect any mutation to result unless I use <code>&amp;mut</code>. (I think that's not ironclad but it's pretty close to the truth)</p>



<a name="230760514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760514">(Mar 17 2021 at 20:25)</a>:</h4>
<p>so there's no observable change in that code between <code>Range: Copy</code> and <code>Interval: Copy + IntoIterator&lt;IntoIter = Range&gt;</code></p>



<a name="230760630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760630">(Mar 17 2021 at 20:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="271719">Mario Carneiro</span> <a href="#narrow/stream/268952-edition-2021/topic/range.20reform/near/230760454">said</a>:</p>
<blockquote>
<p><code>for</code> takes its argument by value, so I don't expect any mutation to result unless I use <code>&amp;mut</code>. (I think that's not ironclad but it's pretty close to the truth)</p>
</blockquote>
<p>but the whole reason we don't have <code>Copy</code> iterators hinges on that not being an obvious fact</p>



<a name="230760643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760643">(Mar 17 2021 at 20:26)</a>:</h4>
<p>and preventing accidental copies</p>



<a name="230760709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760709">(Mar 17 2021 at 20:27)</a>:</h4>
<p>it's basically a lint baked into a fundamental trait not being implemented</p>



<a name="230760753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760753">(Mar 17 2021 at 20:27)</a>:</h4>
<p><code>Interval: Copy + IntoIterator&lt;IntoIter = Range&gt;</code> addresses <em>the letter</em> of that but not <em>the spirit</em></p>



<a name="230760858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230760858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230760858">(Mar 17 2021 at 20:28)</a>:</h4>
<p>the rule isn't <code>Iterator XOR Copy</code>, it's "we don't want to make copies get misconstrued as something else"</p>



<a name="230761236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761236">(Mar 17 2021 at 20:31)</a>:</h4>
<p><span class="user-mention silent" data-user-id="271719">Mario Carneiro</span> <a href="#narrow/stream/268952-edition-2021/topic/range.20reform/near/230760225">said</a>:</p>
<blockquote>
<p>I don't follow. That argument seems to apply here. <code>0..10</code> is copy but <code>(0..10).into_iter()</code> isn't</p>
</blockquote>
<p>note that this <em>would</em> address the argument <em>if</em> the new type <em>did not</em> implement <code>IntoIterator</code></p>



<a name="230761279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761279">(Mar 17 2021 at 20:31)</a>:</h4>
<p>I am probably too used to the status quo to see what alternative is being confused here. What would you write that looks like a mutating iterator but is a copy instead?</p>



<a name="230761303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761303">(Mar 17 2021 at 20:31)</a>:</h4>
<p>if you were forced to write <code>for i in range.iter()</code> or something, then yes, <code>typeof(range): Copy</code> would be meaningfully different from <code>typeof(range.iter()): Copy</code></p>



<a name="230761418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761418">(Mar 17 2021 at 20:32)</a>:</h4>
<p><span class="user-mention silent" data-user-id="271719">Mario Carneiro</span> <a href="#narrow/stream/268952-edition-2021/topic/range.20reform/near/230761279">said</a>:</p>
<blockquote>
<p>I am probably too used to the status quo to see what alternative is being confused here. What would you write that looks like a mutating iterator but is a copy instead?</p>
</blockquote>
<p>but if you believe that you should believe that any iterator that can implement <code>Copy</code> should do so, right?</p>



<a name="230761443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761443">(Mar 17 2021 at 20:32)</a>:</h4>
<p>except in cases where we want to reserve the right to e.g. allocate or w/e</p>



<a name="230761470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761470">(Mar 17 2021 at 20:32)</a>:</h4>
<p>Iterators that implement copy cause some problem but I'm having trouble coming up with the problem case</p>



<a name="230761495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761495">(Mar 17 2021 at 20:33)</a>:</h4>
<p>my example is the problem!</p>



<a name="230761534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761534">(Mar 17 2021 at 20:33)</a>:</h4>
<p>that's <em>the</em> argument for not having <code>Copy</code> on iterators</p>



<a name="230761554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761554">(Mar 17 2021 at 20:33)</a>:</h4>
<p>it's something neither of us has issue with, but that <em>is</em> it</p>



<a name="230761567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761567">(Mar 17 2021 at 20:33)</a>:</h4>
<p>that's one half of the problem, but it's being confused with some similar looking code that does something else, no?</p>



<a name="230761666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761666">(Mar 17 2021 at 20:34)</a>:</h4>
<p>nothing comes to mind</p>



<a name="230761721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761721">(Mar 17 2021 at 20:34)</a>:</h4>
<p>I am not aware of another argument for why iterators shouldn't be <code>Copy</code></p>



<a name="230761761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761761">(Mar 17 2021 at 20:34)</a>:</h4>
<p>I thought there was a way to write it so that the <code>0..10</code> gets mutated, but there isn't an obvious way to do it without putting <code>mut</code> everywhere which gives away the game</p>



<a name="230761776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761776">(Mar 17 2021 at 20:35)</a>:</h4>
<p>there's only <code>&amp;mut</code></p>



<a name="230761801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761801">(Mar 17 2021 at 20:35)</a>:</h4>
<p><em>but</em> it used to be that <code>for</code> loops desugared differently for iterators</p>



<a name="230761874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761874">(Mar 17 2021 at 20:35)</a>:</h4>
<p>when we changed that to <em>always</em> call <code>IntoIterator::into_iter</code>, <em>that's when</em> my example became a problem</p>



<a name="230761896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761896">(Mar 17 2021 at 20:35)</a>:</h4>
<p>because that used to compile and mutate the variable (in the old desugaring)</p>



<a name="230761929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761929">(Mar 17 2021 at 20:36)</a>:</h4>
<p>I remember having a run in with this on my own type that implemented copy + iterator, but I think that was in the context of <code>iter.map(..)</code> where autoderef can hide mutation</p>



<a name="230761993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230761993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230761993">(Mar 17 2021 at 20:36)</a>:</h4>
<p>autoderef can hide copies, not mutation</p>



<a name="230762102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762102">(Mar 17 2021 at 20:37)</a>:</h4>
<p>I mean I wanted <code>(&amp;mut iter).map(..)</code> and got <code>{iter}.map(..)</code> so it wasn't mutated as expected</p>



<a name="230762125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762125">(Mar 17 2021 at 20:37)</a>:</h4>
<p>yupp</p>



<a name="230762184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762184">(Mar 17 2021 at 20:37)</a>:</h4>
<p>anyway my simplest suggestion to how to deal with this is <code>MustClone</code></p>



<a name="230762288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762288">(Mar 17 2021 at 20:38)</a>:</h4>
<p>I don't think this issue comes up in for loops though, because there is no hidden <code>&amp;mut</code></p>



<a name="230762291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762291">(Mar 17 2021 at 20:38)</a>:</h4>
<p>you just make people call <code>.clone()</code> as today (and the type moves like today), but you're not banned from implementing <code>Copy</code> on types that contain iterator types</p>



<a name="230762320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762320">(Mar 17 2021 at 20:38)</a>:</h4>
<p><span class="user-mention silent" data-user-id="271719">Mario Carneiro</span> <a href="#narrow/stream/268952-edition-2021/topic/range.20reform/near/230762288">said</a>:</p>
<blockquote>
<p>I don't think this issue comes up in for loops though, because there is no hidden <code>&amp;mut</code></p>
</blockquote>
<p>there's never a hidden <code>&amp;mut</code></p>



<a name="230762327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762327">(Mar 17 2021 at 20:38)</a>:</h4>
<p>there <em>used to be</em></p>



<a name="230762387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762387">(Mar 17 2021 at 20:39)</a>:</h4>
<p>and ironically the fact that it got removed is how we ended up in this <code>!Copy</code> mess</p>



<a name="230762390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762390">(Mar 17 2021 at 20:39)</a>:</h4>
<p>There is a hidden <code>&amp;mut</code> in method calls (sometimes)</p>



<a name="230762483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762483">(Mar 17 2021 at 20:39)</a>:</h4>
<p>but that exists with <code>!Copy</code> types anyway, the concern is about <em>not</em> mutating when you <em>want to</em></p>



<a name="230762553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762553">(Mar 17 2021 at 20:40)</a>:</h4>
<p>and the confusion is that the user is thinking about the <code>&amp;mut iter</code> call but rust prefers the <code>{iter}</code> call</p>



<a name="230762642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762642">(Mar 17 2021 at 20:40)</a>:</h4>
<p>right, that's the same as my <code>for</code> loops example I guess</p>



<a name="230762683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762683">(Mar 17 2021 at 20:41)</a>:</h4>
<p>just a bit more subtle</p>



<a name="230762728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762728">(Mar 17 2021 at 20:41)</a>:</h4>
<p>keep in mind it looks obvious because it's designed to be understood</p>



<a name="230762731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762731">(Mar 17 2021 at 20:41)</a>:</h4>
<p>the difference in for loops is that it will never take a <code>&amp;mut</code>, so the user normally won't be expecting this unless they are new to rust</p>



<a name="230762781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230762781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230762781">(Mar 17 2021 at 20:41)</a>:</h4>
<p>in practice there's usually more code around</p>



<a name="230763687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230763687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230763687">(Mar 17 2021 at 20:47)</a>:</h4>
<p>so that makes me realize a funny thing about the range reform: which is that now I will have to write <code>(i..j).into_iter().map(|x| ...)</code> - instead of the <code>MustClone</code> approach of only making the plausibly-ambiguous situations require <code>.clone()</code> - so it's likely to have a negative ergonomic impact on the kind of code I tend to use ranges for (while both approaches letting me <code>Copy</code> structs wrapping whatever <code>i..j</code> produces)</p>



<a name="230764023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230764023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230764023">(Mar 17 2021 at 20:49)</a>:</h4>
<p>though I wonder if that ergonomic tradeoff is really the whole point here</p>



<a name="230764051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230764051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230764051">(Mar 17 2021 at 20:49)</a>:</h4>
<p>or rather, I'm worried that it may be</p>



<a name="230783479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230783479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230783479">(Mar 17 2021 at 23:00)</a>:</h4>
<p>I don't think the wrapper struct is the <em>only</em> motivation, I have to clone ranges for intra doc links regularly and it feels really weird</p>



<a name="230787233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230787233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230787233">(Mar 17 2021 at 23:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/268952-edition-2021/topic/range.20reform/near/230783479">said</a>:</p>
<blockquote>
<p>I don't think the wrapper struct is the <em>only</em> motivation, I have to clone ranges for intra doc links regularly and it feels really weird</p>
</blockquote>
<p>we're all agreeing we want to be able to <code>Copy</code> ranges :P</p>



<a name="230787383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230787383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230787383">(Mar 17 2021 at 23:43)</a>:</h4>
<p>it's just not clear to me what adding more types achieves, other than worse ergonomics when using ranges as iterators</p>



<a name="230787478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230787478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230787478">(Mar 17 2021 at 23:44)</a>:</h4>
<p>if accidental copying isn't a concern, just make all the iterators <code>Copy</code> already<br>
if it <em>really is</em> a concern, a specialized lint or even my <code>MustClone</code> idea, seem more appropriate</p>



<a name="230789604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230789604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230789604">(Mar 18 2021 at 00:06)</a>:</h4>
<p>However, having to now type</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">for</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="mi">0</span><span class="o">..</span><span class="mf">10.</span><span class="n">clone</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>Seems equally "things got worse"</p>



<a name="230792079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230792079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230792079">(Mar 18 2021 at 00:34)</a>:</h4>
<p>I don't think you would ever need to write that, since that's the only use of <code>0..10</code> in the code. You only need to <code>.clone()</code> if you have the range in a variable that is being reused</p>



<a name="230792161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230792161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230792161">(Mar 18 2021 at 00:35)</a>:</h4>
<p>(also the precedence on that is wrong; hopefully clippy will point out that you are cloning <code>10</code> and not <code>0..10</code>)</p>



<a name="230822179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230822179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230822179">(Mar 18 2021 at 07:21)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> the <code>MustClone</code> idea wouldn't affect any code that works today</p>



<a name="230822256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230822256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230822256">(Mar 18 2021 at 07:22)</a>:</h4>
<p>it just allows implementing <code>Copy</code> on e.g. types that wrap <code>Range</code>, or passing a <code>Range</code> to a type expecting some <code>T: Copy</code></p>



<a name="230822264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230822264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230822264">(Mar 18 2021 at 07:22)</a>:</h4>
<p>the name might not be ideal, but that's what it'd do</p>



<a name="230822380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230822380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230822380">(Mar 18 2021 at 07:24)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> note that I put it through crater even, and the only regressions where some crates aggressively denying lints (which, kind of ironic, lol)</p>



<a name="230822407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230822407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230822407">(Mar 18 2021 at 07:24)</a>:</h4>
<p>so I'm fairly confident it's backwards-compatible to do, without an edition etc.</p>



<a name="230873206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230873206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230873206">(Mar 18 2021 at 14:33)</a>:</h4>
<p><span class="user-mention" data-user-id="243558">@Steven Fackler</span> I have to say, I'm wondering if we are rushing a bit here -- I'm worried that changing the <code>..</code> expansion will be more painful than we think, and we won't have time for 2021 to figure that out (e.g., APIs that were using <code>Range</code> would now break across editions, etc -- maybe all those APIs are generic, so it's ok, but still)</p>



<a name="230873236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230873236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230873236">(Mar 18 2021 at 14:33)</a>:</h4>
<p>Also, the <code>#[must_clone]</code> lint feels like a good idea regardless</p>



<a name="230873252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230873252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230873252">(Mar 18 2021 at 14:33)</a>:</h4>
<p>It is useful for things like <code>Cell</code></p>



<a name="230873369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230873369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230873369">(Mar 18 2021 at 14:34)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> pointed out the (persuasive to me) argument that </p>
<div class="codehilite"><pre><span></span><code>let x = 1..3;
for elem in x { if elem == 2 { break } }
for elem in x { }
</code></pre></div>
<p>still works if <code>x</code> only implements <code>IntoIterator</code></p>



<a name="230873391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230873391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230873391">(Mar 18 2021 at 14:34)</a>:</h4>
<p>so it comes down to there being an extra field on <code>RangeInclusive</code>?</p>



<a name="230873445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230873445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230873445">(Mar 18 2021 at 14:34)</a>:</h4>
<p>this is a bit unfortunate, I admit :/</p>



<a name="230873558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230873558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230873558">(Mar 18 2021 at 14:35)</a>:</h4>
<p>I guess I haen't caught up on (e.g.) the RFC, I'm not sure how much it spells out these considerations and the reaosns to go one way or the other?</p>



<a name="230873566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230873566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230873566">(Mar 18 2021 at 14:35)</a>:</h4>
<p>I'd like to read the full case</p>



<a name="230873735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230873735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230873735">(Mar 18 2021 at 14:36)</a>:</h4>
<p>(ftr the long conversation in this backlog here started from that same snippet)</p>



<a name="230873819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230873819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230873819">(Mar 18 2021 at 14:36)</a>:</h4>
<p>sadly we can't collapse subthreads to make messages like that more visible :(</p>



<a name="230874549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874549">(Mar 18 2021 at 14:40)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> the RFC does discuss those points, yes</p>



<a name="230874619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874619">(Mar 18 2021 at 14:41)</a>:</h4>
<p>let me read it :)</p>



<a name="230874642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874642">(Mar 18 2021 at 14:41)</a>:</h4>
<p>is it still a draft?</p>



<a name="230874647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874647">(Mar 18 2021 at 14:41)</a>:</h4>
<p>IMO #[must_clone] is a bad fit for these types because it's saying "hey, on the off chance that you are using your Range as an iterator, don't implicitly copy it", but there are tons of cases where you <em>aren't</em> using your Range as an iterator</p>



<a name="230874650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874650">(Mar 18 2021 at 14:41)</a>:</h4>
<p>or is there a final PR now</p>



<a name="230874671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874671">(Mar 18 2021 at 14:41)</a>:</h4>
<p>so---</p>



<a name="230874682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874682">(Mar 18 2021 at 14:41)</a>:</h4>
<p>still a draft - I just need to fill out the user description section</p>



<a name="230874683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874683">(Mar 18 2021 at 14:41)</a>:</h4>
<p>Hmm</p>



<a name="230874690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874690">(Mar 18 2021 at 14:41)</a>:</h4>
<p>One thought is that</p>



<a name="230874694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874694">(Mar 18 2021 at 14:42)</a>:</h4>
<p>but the actual concrete proposal should be there</p>



<a name="230874742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874742">(Mar 18 2021 at 14:42)</a>:</h4>
<p><code>#[must_clone]</code> may not want to be applied to the <em>types</em> but more the pattern in code</p>



<a name="230874776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874776">(Mar 18 2021 at 14:42)</a>:</h4>
<p>e.g., we could say that "any time you do <code>for x in y</code> twice, you probably want to be explicit</p>



<a name="230874791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874791">(Mar 18 2021 at 14:42)</a>:</h4>
<p>(where <code>y</code> is of <code>Copy</code> type)</p>



<a name="230874795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874795">(Mar 18 2021 at 14:42)</a>:</h4>
<p>I think we probably want both</p>



<a name="230874833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874833">(Mar 18 2021 at 14:42)</a>:</h4>
<p>but maybe <code>Range</code> is not a <code>#[must_clone]</code> type, it's just that we get the warning for this usage pattern</p>



<a name="230874913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874913">(Mar 18 2021 at 14:43)</a>:</h4>
<p>I guess I think we decided some time back to make <code>Copy</code> mean "POD" as well as "doens't move" -- around 1.0, iirc -- on the premise that we could lint our way away from user errors</p>



<a name="230874925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874925">(Mar 18 2021 at 14:43)</a>:</h4>
<p>sure, but that still doesn't fix the RangeInclusive API, and I'm a bit suspicious we can make a sufficiently advanced pattern recognizer in the compiler for all the relevant cases</p>



<a name="230874931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230874931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230874931">(Mar 18 2021 at 14:43)</a>:</h4>
<p>I'm a bit worried that we are solving one niche part but not the rest</p>



<a name="230875004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875004">(Mar 18 2021 at 14:43)</a>:</h4>
<p><span class="user-mention silent" data-user-id="243558">Steven Fackler</span> <a href="#narrow/stream/268952-edition-2021/topic/range.20reform/near/230874925">said</a>:</p>
<blockquote>
<p>sure, but that still doesn't fix the RangeInclusive API, and I'm a bit suspicious we can make a sufficiently advanced pattern recognizer in the compiler for all the relevant cases</p>
</blockquote>
<p>this may be true, but then I suspect many of those patterns are of less and less importance over time</p>



<a name="230875074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875074">(Mar 18 2021 at 14:44)</a>:</h4>
<p>a hybrid might make sense</p>



<a name="230875087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875087">(Mar 18 2021 at 14:44)</a>:</h4>
<p>fixing <code>RangeInclusive</code> only</p>



<a name="230875110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875110">(Mar 18 2021 at 14:44)</a>:</h4>
<p>oh, but then we introduce asymmetry</p>



<a name="230875125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875125">(Mar 18 2021 at 14:44)</a>:</h4>
<p>which I remember also arguing against (and which I still believe)</p>



<a name="230875145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875145">(Mar 18 2021 at 14:44)</a>:</h4>
<p>anyway, let me skim the RFC :)</p>



<a name="230875190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875190">(Mar 18 2021 at 14:45)</a>:</h4>
<p>I mean, from a library design perspective, these types should not have implemented Iterator at any point. Some of the side effects of that design error are the Copy issue, and the RangeInclusive API issue, but we should fix the root of the problem</p>



<a name="230875312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875312">(Mar 18 2021 at 14:45)</a>:</h4>
<p>I'm thinking about the ergonomics of <code>(0..i).map(|i| ...)</code> I guess. I think I do that a lot.</p>



<a name="230875420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875420">(Mar 18 2021 at 14:46)</a>:</h4>
<p><code>.into_iter()</code> is also "ok", I might even prefer <code>Range::into_iter(1...5).map(|i| ...)</code></p>



<a name="230875573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875573">(Mar 18 2021 at 14:47)</a>:</h4>
<p><span class="user-mention" data-user-id="243558">@Steven Fackler</span> maybe what I'm saying is that I'm not convinced this:</p>
<blockquote>
<p>We do not allow iterator types to be Copy, as it can cause confusion when an implicit copy of an iterator is advanced rather than the original.</p>
</blockquote>
<p>ought to be a general rule. There might still be a case for range reform without that, though.</p>



<a name="230875629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875629">(Mar 18 2021 at 14:47)</a>:</h4>
<p>(I guess we could also add <code>map</code> to the <code>IntoIterator</code> trait :)</p>



<a name="230875683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875683">(Mar 18 2021 at 14:48)</a>:</h4>
<p>er, no, maybe not</p>



<a name="230875690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875690">(Mar 18 2021 at 14:48)</a>:</h4>
<p>well, yes</p>



<a name="230875914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230875914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230875914">(Mar 18 2021 at 14:49)</a>:</h4>
<p>well, no, because all iterators are into-iterator, duh</p>



<a name="230876398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876398">(Mar 18 2021 at 14:52)</a>:</h4>
<p>I am quite skeptical of edition specific type aliases</p>



<a name="230876412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876412">(Mar 18 2021 at 14:52)</a>:</h4>
<p>But maybe I need to get over it</p>



<a name="230876427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876427">(Mar 18 2021 at 14:52)</a>:</h4>
<p>It feels to me like a recipe for confusion</p>



<a name="230876488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876488">(Mar 18 2021 at 14:52)</a>:</h4>
<p>e.g., I look in some crate that is using Rust 2018 and it says <code>std::ops::Range</code>, but my crate is Rust 2021... not to mention the complications that could arise around macros and macro expansions</p>



<a name="230876643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876643">(Mar 18 2021 at 14:53)</a>:</h4>
<p>So that specific bit isn't <em>strictly</em> necessary, but without it we just end up in a world where we have in <code>std::ops</code> <code>pub type Range&lt;T&gt; = self::range::IntoIter&lt;T&gt;;</code> which is confusing in its own right</p>



<a name="230876668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876668">(Mar 18 2021 at 14:53)</a>:</h4>
<p>but we can maybe fix that up in another future edition or something</p>



<a name="230876762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876762">(Mar 18 2021 at 14:54)</a>:</h4>
<p>well</p>



<a name="230876791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876791">(Mar 18 2021 at 14:54)</a>:</h4>
<p>Hmm</p>



<a name="230876815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876815">(Mar 18 2021 at 14:54)</a>:</h4>
<p>I would have said let's introduce fresh names -- and I still think that</p>



<a name="230876820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876820">(Mar 18 2021 at 14:54)</a>:</h4>
<p>e.g., <code>Interval</code></p>



<a name="230876863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876863">(Mar 18 2021 at 14:54)</a>:</h4>
<p>I hadn't considered that we might keep <code>Range</code> as an alias to <code>Interval::IntoIter</code></p>



<a name="230876903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876903">(Mar 18 2021 at 14:55)</a>:</h4>
<p>certainly we could deprecate the <code>std::ops::Range</code>, though that's unfortunate because it's a nice name to use</p>



<a name="230876936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876936">(Mar 18 2021 at 14:55)</a>:</h4>
<p>but if we picked a new name (e.g., interval) that is not a problem</p>



<a name="230876979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230876979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230876979">(Mar 18 2021 at 14:55)</a>:</h4>
<p>do type aliases work everywhere that we would need them to work? (patterns, struct initializers, I guess)</p>



<a name="230877271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230877271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230877271">(Mar 18 2021 at 14:57)</a>:</h4>
<p>it does work in those cases, but there may be some other obscure places that don't handle aliases: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=547916139993268121354dcec98ba785">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=547916139993268121354dcec98ba785</a></p>



<a name="230877450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230877450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230877450">(Mar 18 2021 at 14:58)</a>:</h4>
<p>re: switching to Interval, it is also confusing to go into the rustdoc for std::ops and see the <code>Range</code> type and the <code>Interval</code> type next to each other! :)</p>



<a name="230878191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230878191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230878191">(Mar 18 2021 at 15:02)</a>:</h4>
<p>The RFC currently prioritizes minimizing API weirdness rolling forward when most people are using the 2021 edition, at the price of a bit of weirdness during the transition.</p>



<a name="230886955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230886955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230886955">(Mar 18 2021 at 15:47)</a>:</h4>
<p>I'd like to see it extended to cover that :)</p>



<a name="230887010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230887010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230887010">(Mar 18 2021 at 15:47)</a>:</h4>
<p>(that comparison)</p>



<a name="230894824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230894824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230894824">(Mar 18 2021 at 16:21)</a>:</h4>
<p>Cool, will do</p>



<a name="230898952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230898952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230898952">(Mar 18 2021 at 16:49)</a>:</h4>
<p>rather than must_clone always, which is indeed poor, why can't we just lint when it's used in <code>for</code> loop position only?</p>



<a name="230899300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230899300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230899300">(Mar 18 2021 at 16:51)</a>:</h4>
<p>Like, ignoring the RangeInclusive issue for a moment, that really seems like the simplest fix. If you use a <code>must_clone</code> any time <em>after</em> you used it in a <code>for</code> loop, you get a warning.</p>



<a name="230899489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230899489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230899489">(Mar 18 2021 at 16:52)</a>:</h4>
<p>If that's really what this whole concern is about.</p>



<a name="230899961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230899961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230899961">(Mar 18 2021 at 16:55)</a>:</h4>
<p>though honestly the fact that i can write</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">10</span><span class="p">;</span><span class="w"></span>
<span class="k">for</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="mi">0</span><span class="o">..</span><span class="n">a</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="k">for</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="mi">0</span><span class="o">..</span><span class="n">a</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>
<p>but <strong>not</strong></p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="o">..</span><span class="mi">10</span><span class="p">;</span><span class="w"></span>
<span class="k">for</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="k">for</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>
<p>has always seemed <em>entirely</em> silly.</p>



<a name="230906500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230906500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230906500">(Mar 18 2021 at 17:32)</a>:</h4>
<p>is it any more silly than the fact that you can do</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">"foo"</span><span class="p">;</span><span class="w"></span>
<span class="nb">drop</span><span class="p">(</span><span class="nb">String</span>::<span class="n">from</span><span class="p">(</span><span class="n">a</span><span class="p">));</span><span class="w"></span>
<span class="nb">drop</span><span class="p">(</span><span class="nb">String</span>::<span class="n">from</span><span class="p">(</span><span class="n">a</span><span class="p">));</span><span class="w"></span>
</code></pre></div>
<p>but not</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">String</span>::<span class="n">from</span><span class="p">(</span><span class="s">"foo"</span><span class="p">);</span><span class="w"></span>
<span class="nb">drop</span><span class="p">(</span><span class="n">a</span><span class="p">);</span><span class="w"></span>
<span class="nb">drop</span><span class="p">(</span><span class="n">a</span><span class="p">);</span><span class="w"></span>
</code></pre></div>
<p>?</p>



<a name="230906737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230906737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230906737">(Mar 18 2021 at 17:34)</a>:</h4>
<p>yes. the String is about making allocations explicit, not just about making modification (to a copy) explicit</p>



<a name="230909690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230909690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230909690">(Mar 18 2021 at 17:51)</a>:</h4>
<p>Yes, exactly as Mara said. <code>String</code> is a type that will <code>Drop</code> because it manages a memory allocation.</p>
<p>When a person asks "why doesn't this work?" we can explain that there's a deallocation involved and you can't deallocate the same memory twice.</p>
<p>and then there's this other thing that just has two integers in it. And the beginner says "Oh, well, that's just two integers, so it doesn't have to Drop, right?" and we must reply to them "True, but we still don't trust that you could ever write the code properly on your own, so we still don't let you Copy that value either".</p>



<a name="230916162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230916162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230916162">(Mar 18 2021 at 18:32)</a>:</h4>
<p>IIRC the (theoretical) problem only occurs if the range is mutable -- is there something we could do just for that?</p>



<a name="230916181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230916181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230916181">(Mar 18 2021 at 18:32)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/27186#issuecomment-123390413">https://github.com/rust-lang/rust/pull/27186#issuecomment-123390413</a></p>



<a name="230917075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230917075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230917075">(Mar 18 2021 at 18:39)</a>:</h4>
<p>maybe a lint for types where copying from <code>mut</code> (or <code>&amp;mut</code>)  might be unintended</p>



<a name="230917225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/230917225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#230917225">(Mar 18 2021 at 18:40)</a>:</h4>
<p>although anything that was formerly a move (without further use) might now look like a copy and trigger that</p>



<a name="231105143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105143">(Mar 19 2021 at 23:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/268952-edition-2021/topic/range.20reform/near/230875312">said</a>:</p>
<blockquote>
<p>I'm thinking about the ergonomics of <code>(0..i).map(|i| ...)</code> I guess. I think I do that a lot.</p>
</blockquote>
<p>What if <code>Range</code> impl'd <code>Deref</code> to <code>RangeIter</code>? I don't think that collides with anything else, and it would probably prevent a lot of breakage of 2018 patterns like this one</p>



<a name="231105278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105278">(Mar 19 2021 at 23:47)</a>:</h4>
<p>How would you implement that?</p>



<a name="231105362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105362">(Mar 19 2021 at 23:48)</a>:</h4>
<p>oh wait, that doesn't work since you need mutable access to the iterator</p>



<a name="231105384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105384">(Mar 19 2021 at 23:48)</a>:</h4>
<p>you also need an instance of the iterator</p>



<a name="231105413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105413">(Mar 19 2021 at 23:49)</a>:</h4>
<p>It could <code>DerefMut</code> to an iterator that modifies the original <code>Range</code> but I think that's exactly the problem pattern I was talking about earlier to <span class="user-mention silent" data-user-id="119009">eddyb</span></p>



<a name="231105442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105442">(Mar 19 2021 at 23:49)</a>:</h4>
<p>you can implement it if it's a transparent wrapper struct and you transmute it</p>



<a name="231105546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105546">(Mar 19 2021 at 23:50)</a>:</h4>
<p>But then it would not be Copy, and that would be missing a field for RangeInclusive</p>



<a name="231105578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105578">(Mar 19 2021 at 23:51)</a>:</h4>
<p>why wouldn't it be copy?</p>



<a name="231105596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105596">(Mar 19 2021 at 23:51)</a>:</h4>
<p>If it was a transparent wrapper struct around a non-copy type</p>



<a name="231105608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105608">(Mar 19 2021 at 23:51)</a>:</h4>
<p>It's a non-copy transparent wrapper struct around a copy type</p>



<a name="231105612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105612">(Mar 19 2021 at 23:51)</a>:</h4>
<p>if it was the other way around it'd work for Range, but not RangeInclusive</p>



<a name="231105618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105618">(Mar 19 2021 at 23:51)</a>:</h4>
<p>you're right that it doesn't work for <code>a..=b</code> though</p>



<a name="231105758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105758">(Mar 19 2021 at 23:53)</a>:</h4>
<p>alternatively, duplicate the entire iterator API <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="231105831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105831">(Mar 19 2021 at 23:54)</a>:</h4>
<p>or put all that stuff on a trait</p>



<a name="231105876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/268952-edition%202021/topic/range%20reform/near/231105876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/268952-edition-2021/topic/range.20reform.html#231105876">(Mar 19 2021 at 23:54)</a>:</h4>
<p>which I guess would look like the iterator API except it takes everything by <code>&amp;self</code> or maybe <code>self</code> and calls <code>into_iter()</code> first</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>